Record release time data into bigquery#46
Conversation
| """Converts a CompatibilityResult into a dict which is a row for | ||
| release time table.""" | ||
| if len(cs.packages) != 1 or cs.dependency_info is None: | ||
| return [] |
There was a problem hiding this comment.
Should this be an exception?
There was a problem hiding this comment.
As we only need to write the dependency_info in self compatibility result to release time table, so this is for skipping the pairwise compatibility result and the case when dependency_info is None, which is not an exception.
| 'dep_name': pkg, | ||
| } | ||
| row.update(version_info) | ||
| row['timestamp'] = row.pop('current_time') |
There was a problem hiding this comment.
Do you need to pop this? Can't you just use the value?
There was a problem hiding this comment.
This is for changing the key name from current_time to timestamp in the dict, as current_time is a reserved variable in bigquery.
|
|
||
| @staticmethod | ||
| def _compatibility_status_to_release_time_row( | ||
| cs: CompatibilityResult) -> List: |
There was a problem hiding this comment.
You should specify the type of the list
| cs: CompatibilityResult) -> List: | ||
| """Converts a CompatibilityResult into a dict which is a row for | ||
| release time table.""" | ||
| if len(cs.packages) != 1 or cs.dependency_info is None: |
There was a problem hiding this comment.
Could you add some documentation for dependency_info around line 49 - I can't remember that it is supposed to be.
| # record the py3 version by default. And also record py2 only packages. | ||
| for cs in compatibility_statuses: | ||
| if len(cs.packages) == 1: | ||
| if cs.python_major_version == '3' or \ |
There was a problem hiding this comment.
I think that I would do this in a slightly different way - create a dict mapping install_name to row and build the dict using this loop. Then do a insert_row on the values() of the dict.
That way you don't have to have any version-specific logic.
There was a problem hiding this comment.
Thanks for the suggestion! Done.
Closes #45